package day07.concurrent04;

interface 动物x {
    void eat();
    void say();
}

class 狗x implements 动物x{
    public void eat(){
        System.out.println("狗在么么么的吃..");
    }
    public void say(){
        System.out.println("狗在汪汪汪的叫..");
    }
}
class 猫x implements 动物x{
    public void eat(){
        System.out.println("猫在么么么么的吃..");
    }
    public void say(){
        System.out.println("猫在喵喵喵喵的叫..");
    }
}

class RuningAni implements 动物x{
    private 动物x anix = null;

    public RuningAni(动物x anix) {
        this.anix = anix;
    }

    @Override
    public void eat() {
        anix.eat();
    }

    @Override
    public void say() {
        anix.say();
    }

    public void run(){
        System.out.println("撒欢了跑...");
    }
}

class SleepAni implements 动物x{

    private final 动物x anix;

    public SleepAni(动物x anix) {
        this.anix = anix;
    }

    @Override
    public void eat() {
        anix.eat();
    }

    @Override
    public void say() {
        anix.say();
    }

    public void sleep(){
        System.out.println("呼呼的睡觉...");
    }
}

public class Demo09 {
    public static void main(String[] args) {
        狗x dog = new 狗x();

        猫x cat = new 猫x();

        RuningAni runingDog = new RuningAni(dog);
        runingDog.eat();
        runingDog.say();
        runingDog.run();

        SleepAni sleepCat = new SleepAni(cat);
        sleepCat.eat();
        sleepCat.say();
        sleepCat.sleep();
    }
}
